home *** CD-ROM | disk | FTP | other *** search
-
-
-
- aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee((((3333ddddmmmm)))) aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee((((3333ddddmmmm))))
-
-
-
- NNNNAAAAMMMMEEEE
- alGetFrameTime - Get the time at which a sample frame came in or will go
- out
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////aaaauuuuddddiiiioooo....hhhh>>>>
-
- iiiinnnntttt aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee((((ccccoooonnnnsssstttt AAAALLLLppppoooorrrrtttt ppppoooorrrrtttt,,,, ssssttttaaaammmmpppp____tttt ****ffffnnnnuuuummmm,,,, ssssttttaaaammmmpppp____tttt ****ttttiiiimmmmeeee))))
-
- PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
- _p_o_r_t expects the AAAALLLLppppoooorrrrtttt structure for the audio port for which you wish
- to know the sample frame number. This structure is the returned
- value of the aaaallllOOOOppppeeeennnnPPPPoooorrrrtttt((((3333ddddmmmm)))) call.
-
- _f_n_u_m expects a pointer to an unsigned 64-bit value which is to contain
- the resultant sample-frame number.
-
- _t_i_m_e expects a pointer to an unsigned 64-bit value which is to contain
- the resultant sample-frame time, in nanoseconds.
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee returns an atomic pair of (fnum, time) for the device to
- which _p_o_r_t is connected. For an input device, the time returned is the
- time at which the returned sample frame arrived at the electrical input
- on the machine. For an output device, the time returned is the time at
- which the returned sample frame will arrive at the electrical output on
- the machine.
-
- The application cannot request a specific pair of values; aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee
- merely returns the most recent pair available. It is up to the
- application to use this pair to calculate the time associated with a
- particular sample-frame, or the sample-frame number associated with a
- particular time, if desired.
-
- In general, the returned sample frame will not currently be in any
- application's port. For example, an input sample frame as returned by
- aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee may be "in the future": it has not yet arrived in any
- application's port. Similarly, an output sample frame may be "in the
- past": it has already gone out of some application's port. In order to
- relate the sample frame numbers to those of a particular application's
- audio port, the aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeNNNNuuuummmmbbbbeeeerrrr call must be used.
-
- aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee uses the Unadjusted System Time (UUUUSSSSTTTT) as its timeline.
- This allows it to relate to other media which also use UUUUSSSSTTTT. See the man
- page for ddddmmmmGGGGeeeettttUUUUSSSSTTTT((((3333ddddmmmm)))) for more information on UST.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEE
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee((((3333ddddmmmm)))) aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee((((3333ddddmmmm))))
-
-
-
- stamp_t fn, t;
- stamp_t fnd,td;
- double nanosec_per_frame = 1000000000.0 / rate_in_Hz;
-
- /*
- * Get the device sample frame number associated with the next
- * audio sample frame I'm going to read or write from this port
- */
- alGetFrameNumber(port, &fn);
-
- /*
- * Get some recent pair of (frame number, time) from the audio
- * device to which my port is connected. time is on a timeline
- * called UST which is given in nanoseconds and shared with the
- * other audio devices and with other media.
- */
- alGetFrameTime(port, &fnd, &td);
-
- /*
- * Calculate the UST associated with fn, the next sample frame
- * we're going to read or write. Because this is signed
- * arithmetic, this code works for both input and output ports.
- */
- t = td + (stamp_t) ((double)(fn - fnd) * nanosec_per_frame);
-
- /*
- * If my port is not in an underflow or overflow state, I can do an
- * alReadFrames or alWriteFrames here and know that t is the time
- * associated with the first sample frame of the buffer I read or
- * write.
- */
-
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- Upon successful completion, aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee returns 0. Otherwise
- aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee returns -1 and sets an error number which can be retrieved
- with oooosssseeeerrrrrrrroooorrrr((((3333CCCC)))).
-
- aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee can fail for the following reasons:
-
- AAAALLLL____BBBBAAAADDDD____PPPPOOOORRRRTTTT
- _p_o_r_t is invalid.
-
- AAAALLLL____BBBBAAAADDDD____NNNNOOOOTTTT____IIIIMMMMPPPPLLLLEEEEMMMMEEEENNNNTTTTEEEEDDDD
- the feature is not implemented on the given machine. aaaallllGGGGeeeettttFFFFrrrraaaammmmeeeeTTTTiiiimmmmeeee
- is not implemented on Indigo R4K (IP20) systems.
-
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- dmGetUST(3dm), alGetFrameNumber(3A), oserror(3C)
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-